#include <iostream>
#include <cstdio>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

int main()
{
    pid_t id = fork();
    if (id == 0)
    {
        sleep(3);
        //child
        execl("/usr/bin/python", "python", "test.py", nullptr);
        //execl("/bin/ls", "ls", "-l", "-a", "--color", nullptr);
        exit(1);
    }
    //father
    pid_t rid = waitpid(id, nullptr, 0);
    if (rid > 0)
    {
        printf("等待子进程成功\n");
    }

   // printf("我是myexec, pid: %d\n", getpid());
   // //execl("./other", "other", nullptr)
   // printf("execl return value: %d\n", n);
   // //execl("/usr/bin/top", "top", nullptr);
    
    return 0;
}
